package com.ruicar.afs.cloud.admin.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruicar.afs.cloud.admin.api.dto.UserSimpleInfoDto;
import com.ruicar.afs.cloud.admin.condition.UserCondition;
import com.ruicar.afs.cloud.common.core.query.QueryCondition;
import com.ruicar.afs.cloud.common.core.security.dto.UserInfo;
import com.ruicar.afs.cloud.admin.entity.SysUser;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.crypto.password.StandardPasswordEncoder;

import java.util.List;

/**
 * @author Fzero
 * @date 2017/10/31
 */
public interface SysUserService extends IService<SysUser> {
	/**
	 * ENCODER
	 */
	PasswordEncoder ENCODER = new StandardPasswordEncoder();

	/**
	 * 查询用户信息
	 *
	 * @param sysUser 用户
	 * @return userInfo
	 */
	UserInfo findUserInfo(SysUser sysUser);


	/**
	 * Validate pass word boolean
	 * <p>Description: </p>
	 *
	 * @param passWord pass word
	 * @return the boolean
	 */
	boolean validatePassWord(String passWord);

	/**
	 * Modify pass boolean
	 * <p>Description: </p>
	 *
	 * @param userDto user dto
	 * @param u       u
	 * @return the boolean
	 */
	Boolean modifyPass(UserCondition userDto, User u);

	void loginFail(String userName);

	void resetLoginFailTime(SysUser user );

	void resetLoginFailTime(String userName);

	List<UserSimpleInfoDto> querySimpleInfosByNames(List<String> userNames);
	Page<UserSimpleInfoDto> pageQuerySimpleUserInfo(QueryCondition<UserSimpleInfoDto> condition);

	List<UserSimpleInfoDto> getSimpleUserListByRoleCode(String roleCode);

	void deleteByUserIds(List<Long> userIds);

	void updateUser(SysUser sysUser);

	void kickOutUser(SysUser sysUser);
}
